from django.conf.urls.defaults import patterns
from django.contrib.auth.decorators import login_required
from jrcsignal.views import ListSignalsView, DeleteSignalView,\
    SignalsMonthArchiveView, UpdateSignalView
from django.views.generic.base import TemplateView
from django.views.generic.list import ListView
from jrcmodel.models import CST

urlpatterns = patterns(
    "jrcsignal.views"
    , (r"^$", "signals_by_month", { "cst_id": 0 })
    , (r"^(?P<cst_id>\d+)/$", "signals_by_month")
    , (r"^list/$", login_required(ListSignalsView.as_view()))
    , (r"^(?P<cst_id>\d+)/parse/$", "parse_signals")
    , (r"^(?P<cst_id>\d+)/parse/(?P<clean>(clean))/$", "parse_signals")
    , (r"^(?P<pk>\d+)/edit/$", login_required(UpdateSignalView.as_view()))
    , (r"^(?P<pk>\d+)/delete/$", login_required(DeleteSignalView.as_view()))
    , (r"^(?P<year>\d{4})/(?P<month>[a-z]{3})/$", login_required(SignalsMonthArchiveView.as_view()), "", "jrcsignal-montly")
    
    , (r"^badcst/(?P<cst_name>[\w\d\-]+)/$", TemplateView.as_view(template_name = "jrcsignal/badcst.html"))
    , (r"^csts/$", login_required(ListView.as_view(model = CST, template_name = "jrcsignal/cst_list.html")))
    , (r"^(?P<cst_id>\d+)/empty/", login_required(TemplateView.as_view(template_name = "jrcsignal/empty.html")))
    #, name = "jrcsignal-monthly"
)
